********************************************************;​

*Linear trends analysis by age group using Logistic Regression*;​

********************************************************;​

​

proc rlogist data = Rx FILETYPE = SAS DESIGN = WR ;​

* Nest statement: PSUs nested within Strata accounts for the design effects*;​

NEST SDMVSTRA SDMVPSU / MISSUNIT;​

* Weight statement: specify appropriate weight, accounts for the unequal probability of sampling and non-response.*;​

WEIGHT wtint2yr;​

* Class statement: specify categorical variable(s). Reflevel statement can be included to choose reference category ​

for the categorical variables. By default SUDAAN uses the highest category*;​

class one /nofreq;​

* Subpopx statement: specify the subpopulation of interest (the inclusion criteria)*;​

subpopx inAnalysis; ​

* Model statement: specifies dependent variable and independent variable(s) *;​

MODEL anyOpioid = ageCat; ​

* Output statement: outputs the results to a file*;​

output / betas=default filename=fig3_logistReg_betas_all replace;​

* Test statement: produces statistics and P values for the Satterthwaite adjusted CHI square (satadjchi), ​

the Satterthwaite adjusted F (satadjf), and Satterthwaite adjusted degrees of freedom (printed by default). ​

If this statement is omitted, the nominal degrees of freedom, ​

the WALDF and the p-value corresponding to the WALDF and WALDP will be produced.*;​

test waldf satadjf satadjchi;​

run;​